<template>
    <el-submenu :key="menu.code" :index="index" v-if="menu.children && menu.children.length > 0"  :style="(menu.level == 2 ? 'border-bottom: #e4e4e4 1px solid':'')">
      <template slot="title">
        <!--<i :class="menu.img"></i>-->
        <img :src="menu.img" width="18" height="18">
        <span>{{menu.description}}</span>
      </template>
      <menu-tree :key="item.code" v-for="(item,seq) in menu.children" :index="index + '-' + seq" :menu="item"></menu-tree>
    </el-submenu>
    <el-menu-item v-else :index="menu.url" :style="(menu.level == 2 ? 'border-bottom: #e4e4e4 1px solid':'')">
      <!--<i :class="menu.img"></i>-->
      <img :src="menu.img" width="18" height="18">
      <span slot="title">{{menu.description}}</span>
    </el-menu-item>
</template>

<script>
export default {
  name: 'menu-tree',
  props: {
    menu: {
      type: Object,
      required: true
    },
    index: {
      type: String,
      required: true
    }
  },
  data () {
    return {
    }
  },
  created: function () {
  },
  methods: {
  }
}
</script>

<style scoped>

</style>
